package com.woniuxy.woniuticket.ordermodule.dao;

import com.woniuxy.woniuticket.pojo.MoviesComment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MoviesCommentDAO {

    int deleteByPrimaryKey(Integer id);

    int insert(MoviesComment record);

    int insertSelective(MoviesComment record);

    MoviesComment selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(MoviesComment record);

    int updateByPrimaryKey(MoviesComment record);

    //根据用户id查询用户对影院的所有评论
    List<MoviesComment> findAllByUserId(@Param("userid")Integer userId);

    //商家查询所有评论
    public List<MoviesComment> findAllByCinema(@Param("currentPage")Integer cpage, @Param("pageSize")Integer psize,@Param("movieName")String movieName);

    //根据电影id查询评论
    public List<MoviesComment> findCommentsByMovieId(@Param("movieid") Integer movieId);

    //根据电影id查询平均评分
    double selectAvgStarByMovieId(int movieId);
}